var e = getApp();

Page({
    data: {},
    onLoad: function(e) {},
    onReady: function() {},
    onShow: function() {
        console.log(e.globalData.integralOtherMiniData, "integralOtherMiniData");
        try {
            e.globalData.integralOtherMiniData.app_id ? (wx.showLoading({
                title: "正在加载"
            }), this.checkLogin()) : wx.reLaunch({
                url: "/packageG/index/index"
            });
        } catch (e) {
            console.log(e), wx.reLaunch({
                url: "/packageG/index/index"
            });
        }
    },
    goHome: function() {
        var a = e.getNetAddresss("plugin.credit-link.frontend.login.index");
        e._postNetWork({
            url: a,
            data: e.globalData.integralOtherMiniData,
            success: function(a) {
                var n = a.data, i = (n.data, n.result), t = n.msg;
                0 === i && e.tips(t), wx.reLaunch({
                    url: "/packageG/index/index"
                });
            },
            fail: function() {
                wx.reLaunch({
                    url: "/packageG/index/index"
                });
            }
        });
    },
    checkLogin: function() {
        var a = this, n = e.getNetAddresss("member.member.isValidatePage");
        e._getNetWork({
            url: n,
            success: function(n) {
                var i = n.data;
                if (1 == i.result) {
                    var t = i.data;
                    try {
                        1 === t.is_login ? a.goHome() : (e.seyzredirect(), wx.redirectTo({
                            url: "/pages/login/login"
                        }));
                    } catch (e) {
                        wx.reLaunch({
                            url: "/packageG/index/index"
                        });
                    }
                } else wx.reLaunch({
                    url: "/packageG/index/index"
                });
            },
            fail: function(e) {
                wx.reLaunch({
                    url: "/packageG/index/index"
                }), console.log(e);
            }
        });
    }
});